import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '审核人',
    align:"center",
    dataIndex: 'personId_dictText'
   },
   {
    title: '顺序',
    align:"center",
    dataIndex: 'sequence',
     customRender:(text)=>{
      if(text=="1"){
        return "第一审核人";
      }
      if(text=="2"){
        return "第二审核人";
      }
      return text;
     }
   },
  {
    title: '类别',
    align:"center",
    dataIndex: 'type_dictText'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '流程人员',
    field: 'personId',
    component: 'JSelectPerson',
    componentProps:{
      isRadioSelection:true
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请选择审核人!'},
          ];
     },
  },
  {
    label: '申请类型id',
    field: 'flowId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入申请类型id!'},
          ];
     },
    show:false,
  },
  {
    label: '顺序',
    field: 'sequence',
    component: 'Select',
    defaultValue:"",
    componentProps:{
      options:[{label:"第一审核人",value:1},{label:"第二审核人",value:2},{label:"第三审核人",value:3},{label:"第四审核人",value:4}
      ,{label:"第五审核人",value:5}]
    },
    suffix:"（抄送类型可不填）"
  },
  {
    label: '类型',
    field: 'type',
    component: 'JDictSelectTag',
    defaultValue:1,
    componentProps:{
      dictCode:"attAuditFlowPersonType",
      stringToNumber:true,
    }
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  personId: {title: '审核人id',order: 0,view: 'text', type: 'string',},
  applyId: {title: '申请类型id',order: 1,view: 'text', type: 'string',},
  sequence: {title: '顺序',order: 2,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
